<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<link href="<%=request.getContextPath()%>/css/jquery-ui.css"
	rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/profile.css"
	rel="stylesheet" type="text/css" />
<script>
	function deleteRoom(roomId) {
		var r=confirm("Bạn có muốn xóa phòng khám này không?")
		if (r==true) {
			$.ajax({
		        url: "/home/delete-room?roomId=" + roomId,
		        type: "get",
		        success: function(){
		            window.location.href="/home/profile-room";
		        },
		        error:function(){
		            alert("Không thể xóa phòng khám này");
		        }
		    });
	  	}	
	}
</script>

	<div class="left menu">
		<jsp:include page="include/profile-menu.jsp"></jsp:include>
	</div>
	<div class="left divider"></div>
	<div class="left admin-main">

		<div class="table">
			<a class="button" href="/home/update-room">Tạo mới phòng khám</a>
			<h3>Danh sách phòng khám:</h3>
			<table border="0">
				<tr>
					<th>Tên phòng khám</th>
					<th>Chuyên khoa</th>
					<th>Cập nhật</th>
					<th>Xóa</th>
				</tr>
				<s:iterator value="rooms" status="time" id="room">
					<tr>
						<td><s:property value="name" /></td>
						<td><s:property value="info" /></td>
						<td><a href="/home/update-room?roomId=<s:property value="roomId" />"><img
								src="<%=request.getContextPath()%>/images/edit.png" title="Cập nhật thông tin" border="0"/></a></td>
						<td><a href="javascript:void(0);"><img
								src="<%=request.getContextPath()%>/images/delete.png" title="Xóa" border="0" onclick="deleteRoom(<s:property value="roomId" />)" /></a></td>
					</tr>
				</s:iterator>
			</table>
		</div>
		<div>Lưu ý: cần thiết lập ít nhất 1 phòng khám bệnh
			theo chuyên khoa, ví dụ: phòng khám nhi, phòng siêu âm, phòng
			xét nghiệm...</div><br/>
	</div>